﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Common;

namespace Ym.print
{
    public partial class News : System.Web.UI.Page
    {
        public int pcount;                      //总条数
        public int page;                        //当前页
        public int pagesize;                    //设置每页显示的大小

        private PBLL.PMenu PbllMenu = new PBLL.PMenu();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OleDbDataReader dr = PbllMenu.GetDr("MUrl='news.aspx'");
                if (dr.Read())
                {
                    this.pagesize = int.Parse(dr["PageYm"].ToString());
                }
                dr.Close();
                RptBind("");
            }
        }

        #region 数据列表绑定
        private void RptBind(string strWhere)
        {
            if (!int.TryParse(Request.Params["page"] as string, out this.page))
            {
                this.page = 0;
            }
            PBLL.PNews PbllNews = new PBLL.PNews();
            //获得总条数
            this.pcount = PbllNews.GetCount();

            this.NewsRpt.DataSource = PbllNews.GetPageList(this.pagesize, this.page, strWhere, "id desc");
            this.NewsRpt.DataBind();
        }
        #endregion
    }
}